package com.itheima;

import java.util.Scanner;

public class demo4 {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        System.out.println("请输入一个字符串：");
        String line = sc.nextLine();

        String ss = reverseString(line);
        System.out.println("字符串反转：" + ss);

    }

    public static String reverseString(String str) {
        String ss = "";
        for (int i = str.length() - 1; i >= 0; i--) {
            ss += str.charAt(i);
        }
        return ss;
    }
}
